<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 联想小鑫
  Date: 2021/11/16
  Time: 8:55
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="js/jquery-1.8.2.min.js"></script>
    <script src="js/fileupload.js"></script>
</head>

<body>
<form action="list.do" method="post">
    菜品: <input type="text" name="cname" value="${cname}"> <br>
    价格: <input type="text" name="pricesx" value="${pricesx}"> ------
    <input type="text" name="pricesd" value="${pricesd}"> <input type="submit" value="查询">
</form>
<table border="1">
    <tr>
        <td><input type="button"onclick="dj()"value="全/不"></td>
        <td>ID</td>
        <td>菜品</td>
        <td>配料</td>
        <td>配料个数</td>
        <td>价格</td>
        <td>    操作
            <button id="addy">添加</button>
        </td>
    </tr>
    <c:forEach items="${list}" var="s">
        <tr>
            <td >
                <input type="checkbox" value="${s.cid}">
            </td>
            <td>${s.cid}</td>
            <td>${s.cname}</td>
            <td>${s.pnames}</td>
            <td>${s.pnum}</td>
            <td>${s.prices}</td>
            <td>
                <button>选料</button>
                <button>查看</button>
            </td>
        </tr>
    </c:forEach>
    <tr>
        <td>
            <button id="ps">批删</button>
        </td>
        <td align="center" colspan="6">
            <button onclick="go(1)">首页</button>
            <button onclick="go(${page.getPageNum()}-1)">上一页</button>
            <button onclick="go(${page.getPageNum()}+1)">下一页</button>
            <button onclick="go(${page.getPages()})">尾页</button>
        </td>
    </tr>
</table>
</body>
<script>
    function dj() {
        $(":checkbox").each(function () {
            $(this).attr("checked",!$(this).attr("checked"));
        })
    }
    function go(pageNum) {
        location="list.do?pageNum="+pageNum+"&"+$("form").serialize();
    }
    $("#addy").click(function () {
        location="addy.do";
    })
</script>
</html>
